package com.dragonboat.service;
import com.dragonboat.entity.Event;

import com.dragonboat.repository.EventRepository;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
import java.util.List;
@Service
public class CommonService {
    @Autowired
    private EventRepository eventRepository;


    public List<Event> getAllEvents() {
        return eventRepository.findAll();
    }

    public List<Event> getUpcomingEvents() {
        return eventRepository.findByStatus("upcoming");
    }



    public Optional<Event> getEventById(Integer eventId) {
        return eventRepository.findById(eventId);
    }
}